import React from 'react'

export default class Clock extends React.Component {
  constructor(props){
    super(props)
    this.state={
      time : new Date(),
      hellow : 'nihao'
    }
  }
  componentDidMount(){
    this.timerId = setInterval(()=>this.tick(),1000)
  }
  componentWillUnmount(){
    clearInterval(this.timerId)
  }
  tick(){
    this.setState({
      time : new Date()
    })
    
  }
  toggle(aa,bb,cc){
    console.log(arguments);
    console.log(this);
  }
  render() {
    return (<div>
      {/* <h2>{this.state.hellow}</h2> */}
      <button onClick={this.toggle.bind(this,456,789,'asdasd')}>点击</button>
      <h2>{this.state.time.toLocaleTimeString()}</h2>
      </div>)
  }

}